Process Group
   HOME

TheInfoList



OR:

In a
POSIX The Portable Operating System Interface (POSIX) is a family of standards specified by the IEEE Computer Society for maintaining compatibility between operating systems. POSIX defines both the system- and user-level application programming interf ...
-conformant
operating system An operating system (OS) is system software that manages computer hardware, software resources, and provides common services for computer programs. Time-sharing operating systems schedule tasks for efficient use of the system and may also in ...
, a process group denotes a collection of one or more processes. Among other things, a process group is used to control the distribution of a
signal In signal processing, a signal is a function that conveys information about a phenomenon. Any quantity that can vary over space or time can be used as a signal to share messages between observers. The '' IEEE Transactions on Signal Processing' ...
; when a signal is directed to a process group, the signal is delivered to each process that is a member of the group. Similarly, a session denotes a collection of one or more process groups. A process may not create a process group that belongs to another session; furthermore, a process is not permitted to join a process group that is a member of another session—that is, a process is not permitted to migrate from one session to another. When a process replaces its image with a new image (by calling one of the exec functions), the new image is subjected to the same process group (and thus session) membership as the old image.


Applications

The distribution of signals to process groups forms the basis of job control employed by shell programs. The TTY device driver incorporates a notion of a foreground process group, to which it sends signals generated by keyboard interrupts, notably
SIGINT Signals intelligence (SIGINT) is intelligence-gathering by interception of ''signals'', whether communications between people (communications intelligence—abbreviated to COMINT) or from electronic signals not directly used in communication ( ...
("interrupt", ), SIGTSTP ("terminal stop", ), and
SIGQUIT Signals are standardized messages sent to a running program to trigger specific behavior, such as quitting or error handling. They are a limited form of inter-process communication (IPC), typically used in Unix, Unix-like, and other POSIX-comp ...
("quit", ). It also sends the
SIGTTIN In Unix and Unix-like operating systems, job control refers to control of jobs by a shell, especially interactively, where a "job" is a shell's representation for a process group. Basic job control features are the suspending, resuming, or termina ...
and
SIGTTOU In Unix and Unix-like operating systems, job control refers to control of jobs by a shell, especially interactively, where a "job" is a shell's representation for a process group. Basic job control features are the suspending, resuming, or termina ...
signals to any processes that attempt to read from or write to the terminal and that are ''not'' in the foreground process group. The shell, in turn, partitions the command pipelines that it creates into process groups, and controls what process group is the foreground process group of its
controlling terminal The POSIX terminal interface is the generalized abstraction, comprising both an application programming interface for programs, and a set of behavioural expectations for users of a terminal (telecommunication), terminal, as defined by the POSIX sta ...
, thus determining what processes (and thus what command pipelines) may perform I/O to and from the terminal at any given time. When the shell forks a new child process for a command pipeline, both the parent shell process and the
child process A child process in computing is a process created by another process (the parent process). This technique pertains to multitasking operating systems, and is sometimes called a subprocess or traditionally a subtask. There are two major procedures ...
immediately make the child process into the leader of the process group for the command pipeline. In this way, it is ensured that the child is the leader of the process group before either the parent or the child relies on this being the case. Where a textual user interface is being used on a Unix-like system, sessions are used to implement
login session In computing, a login session is the period of activity between a user logging in and logging out of a (multi-user) system. On Unix and Unix-like operating systems, a login session takes one of two main forms: * When a textual user interface i ...
s. A single process, the session leader, interacts with the controlling terminal in order to ensure that all programs are terminated when a user "hangs up" the terminal connection. (Where a session leader is absent, the processes in the terminal's foreground process group are expected to handle hangups.) Where a
graphical user interface The GUI ( "UI" by itself is still usually pronounced . or ), graphical user interface, is a form of user interface that allows users to interact with electronic devices through graphical icons and audio indicator such as primary notation, inste ...
is being used, the session concept is largely lost, and the
kernel Kernel may refer to: Computing * Kernel (operating system), the central component of most operating systems * Kernel (image processing), a matrix used for image convolution * Compute kernel, in GPGPU programming * Kernel method, in machine learnin ...
's notion of sessions largely ignored. Graphical user interfaces, such as where the
X display manager In the X Window System, an X display manager is a graphical login manager which starts a login session on an X server from the same or another computer. A display manager presents the user with a login screen. A session starts when a user ...
is employed, use a different mechanism for implementing login sessions.


Details

The
system call In computing, a system call (commonly abbreviated to syscall) is the programmatic way in which a computer program requests a service from the operating system on which it is executed. This may include hardware-related services (for example, acc ...
setsid is used to create a new session containing a single (new) process group, with the current process as both the session leader and the process group leader of that single process group. Process groups are identified by a positive integer, the process group ID, which is the
process identifier In computing, the process identifier (a.k.a. process ID or PID) is a number used by most operating system kernels—such as those of Unix, macOS and Windows—to uniquely identify an active process. This number may be used as a parameter in various ...
of the process that is (or was) the process group leader. Process groups need not necessarily have leaders, although they always begin with one. Sessions are identified by the process group ID of the session leader. POSIX prohibits the change of the process group ID of a session leader. The system call setpgid is used to set the process group ID of a process, thereby either joining the process to an existing process group, or creating a new process group within the session of the process with the process becoming the process group leader of the newly created group. POSIX prohibits the re-use of a process ID where a process group with that identifier still exists (i.e. where the leader of a process group has exited, but other processes in the group still exist). It thereby guarantees that processes may not accidentally become process group leaders. The system call kill is capable of directing signals either to individual processes or to process groups.


See also

*
cgroups cgroups (abbreviated from control groups) is a Linux kernel feature that limits, accounts for, and isolates the resource usage (CPU, memory, disk I/O, network, etc.) of a collection of processes. Engineers at Google started the work on this ...
* Windows
Object Manager Object Manager (internally called Ob) is a subsystem implemented as part of the Windows Executive which manages Windows ''resources''. Resources, which are surfaced as logical ''objects'', each reside in a namespace for categorization. Resources ...
, specifically
Job objects Work or labor (or labour in British English) is intentional activity people perform to support the needs and wants of themselves, others, or a wider community. In the context of economics, work can be viewed as the human activity that cont ...
and associated resource limits


References

* Single UNIX Specification, Issue 6


Further reading

* {{cite book , title = The Design and Implementation of the FreeBSD Operating System , first1 = Marshall Kirk , last1 = McKusick , first2 = George V. , last2 = Neville-Neil , URL = http://www.informit.com/title/0201702452 , date = 2004-08-02 , chapter = FreeBSD Process Management: Process Groups and Sessions , chapter-url = http://www.informit.com/articles/article.aspx?p=366888&seqNum=8 , publisher = Addison Wesley , ISBN = 0-201-70245-2
UNIX Signals and Process Groups
Process (computing) POSIX